package cn.itcast.tlias.com.tliaswork.pojo;

import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

/**
 * 统一返回格式
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    private Integer code; //响应码 1表示成功 0表示失败
    private String msg; //相应信息 描述文字
    private Object data;

    public static Result success() { //增删改响应成功
        return new Result(1, "success", null);
    }

    public static Result success(Object data) { //查询响应成功
        return new Result(1, "success", data);
    }

    public static Result error(String msg) { //查询响应成功
        return new Result(0, msg, null);
    }
}
